package com.cskaoyan.app.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class EncryptUtil {
    public static String encrypt(String rawStr) {
        String encrypted = "passwd";
        try {
            // 其实就是将明文密码转换为md5而已
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            byte[] bytes = rawStr.getBytes();
            md5.update(bytes);
            encrypted = new BigInteger(md5.digest()).toString(16);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return encrypted;
    }
}
